PROJECT(BadPixelDetector)

cmake_minimum_required(VERSION 2.8)

FIND_PACKAGE(QT4 REQUIRED)

if (QT4_FOUND)
  message (STATUS "Looking for Qt4 - found")
  include (${QT_USE_FILE})
else ()
  message (STATUS "Looking for Qt4 - not found")
endif ()


#Find ITk folder
FIND_PACKAGE(ITK)
IF(ITK_FOUND)
   INCLUDE(${ITK_USE_FILE})
ELSE(ITK_FOUND)
   MESSAGE(FATAL_ERROR
           "Cannot build without ITK.  Please set ITK_DIR.")
ENDIF(ITK_FOUND)

SET(BadPixelDetector_SOURCES
	main.cpp
	badpixeldetector.cpp
	YK16GrayImage.cxx
	qyklabel.cpp
	)

SET(BadPixelDetector_HEADERS
	badpixeldetector.h
	YK16GrayImage.h
	qyklabel.h
	)

SET(BadPixelDetector_FORMS
	badpixeldetector.ui)

SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /subsystem:windows /ENTRY:mainCRTStartup")

QT4_WRAP_CPP(BadPixelDetector_HEADERS_MOC ${BadPixelDetector_HEADERS})

INCLUDE(${QT_USE_FILE})
ADD_DEFINITIONS(${QT_DEFINITIONS})

QT4_WRAP_CPP(BadPixelDetector_HEADERS_MOC ${BadPixelDetector_HEADERS})
QT4_WRAP_UI(BadPixelDetector_FORMS_HEADERS ${BadPixelDetector_FORMS})
QT4_ADD_RESOURCES(BadPixelDetector_RESOURCES_RCC ${BadPixelDetector_RESOURCES})

ADD_EXECUTABLE(BadPixelDetector ${BadPixelDetector_SOURCES} 
	${BadPixelDetector_HEADERS} 
    ${BadPixelDetector_HEADERS_MOC} 
    ${BadPixelDetector_FORMS_HEADERS} 
     )
#  ${BadPixelDetector_RESOURCES_RCC}

INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})

SET(QT_USE_QTCORE TRUE)
SET(QT_USE_QTGUI TRUE)
SET(QT_USE_QTOPENGL TRUE)

#TARGET_LINK_LIBRARIES(ItkCon ${ITK_LIBRARIES} )
TARGET_LINK_LIBRARIES(BadPixelDetector ${QT_LIBRARIES} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTOPENGL_LIBRARY} ${ITK_LIBRARIES})